package com.taobao.txc.common;

import com.taobao.txc.common.context.d;

public class TxcContext
{
  public static final int getBeginCount()
  {
    String str = d.a("BEGIN_COUNT");
    return str == null ? 0 : Integer.parseInt(str);
  }
  
  public static final int a()
  {
    String str = d.a("COMMIT_COUNT");
    return str == null ? 0 : Integer.parseInt(str);
  }
  
  public static final void setBegin(int paramInt)
  {
    d.a("BEGIN_COUNT", String.valueOf(paramInt));
  }
  
  public static final void a(int paramInt)
  {
    d.a("COMMIT_COUNT", String.valueOf(paramInt));
  }
  
  public static String b()
  {
    return d.a("TXC_NEXT_SVR_ADDR");
  }
  
  public static final void c()
  {
    d.b("COMMIT_COUNT");
    d.b("BEGIN_COUNT");
  }
  
  public static long d()
  {
    return j.a(getCurrentXid());
  }
  
  public static String getCurrentXid()
  {
    return d.a("TXC_XID");
  }
  
  public static String e()
  {
    String str = d.a("TXC_XID");
    if (str != null)
    {
      int i = str.lastIndexOf(":");
      if (i > 0) {
        return str.substring(0, i);
      }
    }
    return null;
  }
  
  public static void bind(String paramString1, String paramString2)
  {
    d.a("TXC_XID", paramString1);
    d.a("TXC_XID_OWNER", "TXC");
    if (paramString2 != null) {
      d.a("TXC_NEXT_SVR_ADDR", paramString2);
    }
  }
  
  public static boolean inTxcTransaction()
  {
    return getCurrentXid() != null;
  }
  
  public static void unbind()
  {
    d.b("TXC_XID");
    d.b("TXC_XID_OWNER");
    d.b("TXC_NEXT_SVR_ADDR");
  }
  
  public static String suspendTxcTransaction()
  {
    return d.b("TXC_XID");
  }
  
  public static void resumeTxcTransaction(String paramString)
  {
    if (paramString != null) {
      d.a("TXC_XID", paramString);
    }
  }
  
  public static void a(long paramLong)
  {
    d.a("TXC_RETRY_BRANCH", Long.toString(paramLong));
  }
  
  public static void f()
  {
    d.b("TXC_RETRY_BRANCH");
  }
  
  public static boolean g()
  {
    return d.a("TXC_RETRY_BRANCH") != null;
  }
  
  public static long h()
  {
    String str = d.a("TXC_RETRY_BRANCH");
    if (str != null) {
      return Long.parseLong(str);
    }
    return -1L;
  }
  
  public static void a(String paramString)
  {
    if (paramString != null) {
      d.a("MT_UDATA", paramString);
    }
  }
  
  public static String i()
  {
    return d.b("MT_UDATA");
  }
  
  public static boolean j()
  {
    return (inTxcTransaction()) || (g());
  }
  
  public static String k()
  {
    return d.a("TXC_HINT");
  }
  
  public static String l()
  {
    return d.a("TXC_RULE");
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.common.TxcContext
 * JD-Core Version:    0.7.0.1
 */